<script>


    jxt.form.poweredit = function (eleid) {
        jxt.tag.render(eleid, 'poweredit', true);
    };

    jxt.form.ok = function (eleid) {
        var arr = [];
        var ns = $("textarea[data-jxt-form='" + eleid + "']");
        if (ns && ns.length > 0) {
            var list = ns.val().split('\n');
            for (var i = 0; i < list.length; i++) {
                var e = list[i];
                if (!e || !$.trim(e))continue;
                var nv = e.split(':');
                arr.push({name: nv[0].trim(), value: nv[1].trim()});
            }

        }
        else {
            ns = $("input[data-jxt-form='" + eleid + "']");
            ns.each(function (i, e) {
                var n = $(e).attr('name');
                var v = $(e).val();
                arr.push({name: n.trim(), value: v.trim()});
            });
        }
        if(arr&& arr.length>0){
            var n = jxt.getnode(eleid);
            n.content = arr;
            jxt.msg.radio(eleid, "nodechange");
        }

        jxt.tag.ok(eleid);
    };


    jxt.form.create = function (subscribe_id, eventkey, attrs, event_source_id) {
        var node = jxt.newJson(subscribe_id);
        if (attrs && attrs.tpname) {
            node.tpname = attrs.tpname;
        }
        jxt.msg.radio("form", "addmainnode", {"newnodelist": node});
        jxt.route.exe('form.editbegin', null, node.id)

    };
    jxt.msg.subscribe("form", "createform", jxt.form.create);
    jxt.msg.subscribe("selfinfo", "createselfinfo", 'selfinfo.create');
    jxt.msg.subscribe("job_intention", "createjob_intention", 'job_intention.create');

</script>